<!DOCTYPE html>
<html lang="ZH-cn">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>登录页面设计</title>
  <link rel="stylesheet" href="../layui/css/layui.css">
  <script src="../layui/layui.js"></script>

</head>

<body>
<div class="layui-container">
  <div class="layui-row">
    <div class="layui-col-xs12">
        <fieldset class="layui-elem-field layui-field-title">
        </fieldset>
        <form class="layui-form layui-form-pane" action="" >
          <div class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-inline">
              <input type="text" name="username" autocomplete="off" placeholder="用户名/邮箱/手机号" class="layui-input">
            </div>
          </div>

          <div class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-inline">
              <input type="passord" name="passord" autocomplete="off" placeholder="密码" class="layui-input">
            </div>
          </div>

          <div class="layui-form-item">
            <label class="layui-form-label">确认密码</label>
            <div class="layui-input-inline">
              <input type="passord" name="confirm_pass" autocomplete="off" placeholder="确认密码" class="layui-input">
            </div>
          </div>

          <div class="layui-form-item" pane="">
            <div class="layui-input-inline">
              <input type="checkbox" name="remember" lay-skin="primary" title="记住账号">
            </div>
          </div>
          <div class="layui-form-item">
          <div class="layui-inline">
            <label class="layui-form-label">限定可选日期</label>
            <div class="layui-input-inline">
              <input type="text" class="layui-input" id="test" placeholder="yyyy-MM-dd">
            </div>
          </div>
          </div>
          <div class="layui-form-item ">
            <div class="layui-input-block">
              <button class="layui-btn" lay-submit lay-filter="formDemo" >登录</button>
              <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
          </div>

        </form>
    </div>
  </div>
</div>

  <script>
    layui.use(['layer', 'form'], function() {
      var form = layui.form,
        $ = layui.jquery;

      $('#forgot').on('click', function() {
           layer.msg('请联系管理员.');
      });
      //监听提交
      form.on('submit(formDemo)', function(data) {
         console.log(JSON.stringify(data.field));
        // 先获取窗口索引，才能关闭窗口
          var index = parent.layer.getFrameIndex(window.name);
          parent.layer.close(index);
          parent.location.href='test.html';
          return false;
      });
    });
    layui.use('laydate', function() {
        var laydate = layui.laydate;
        var d = new Date();
        d.setTime(d.getTime()-24*60*60*1000);
        var max = d.getFullYear()+"-" + (d.getMonth()+1) + "-" + d.getDate();
        var min=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+"1";
        laydate.render({
            elem: '#test15'
            , type: 'month'
            , range: '~'
            , format: 'yyyy-MM'
        });
        var ins22 = laydate.render({
            elem: '#test',
            range:true,
            min:min,
            max:max
            ,ready: function(){
                ins22.hint('日期可选值设定在 <br> 本月1号 到 昨天');
            }
        });
        laydate.render({
            elem: '#test25'
            , eventElem: '#test25-1'
            , trigger: 'click'
        });
    });
  </script>
</body>

</html>